from typing import Optional, List
from enum import Enum
from pydantic import BaseModel


class ComputeTypeEnum(Enum):
    MapReduce = 1
    MPI = 2


class ComputeScaleEnum(Enum):
    small = 1
    middle = 2
    big = 3


class AddComputeReq(BaseModel):
    ComputeType: int
    ComputeScale: int
    mainNodeMemory: int
    slaveNodeMemory: Optional[int]


class AddComputeRes(BaseModel):
    serviceID: str


class GetComputeListItem(BaseModel):
    id: str
    mainNode: str
    size: int
    mainMemory: int
    slaveMemory: int
    type: int
    time: str


class GetComputeListRes(BaseModel):
    total: int
    item: List[GetComputeListItem]


class DeleteComputeReq(BaseModel):
    serviceID: str


class ScaleComputeReq(BaseModel):
    service_id: str
    #node_id: str
    compute_scale: int


class ScaleComputeRes(BaseModel):
    service_id: str
